
#ifndef _BASESHAPE_H_
#define _BASESHAPE_H_

#include "common.h"

#include "Shape.h"

__BEGIN_NAMESPACE_DECL_

/**
 * Abstract base class that defines common attributes for all 
 * derived classes.
 */
class BaseShape : public Shape
{
    public:
        // Constructor
        BaseShape();
        // Destructor
        virtual ~BaseShape();

        // Sets the offset for the object.  After the object has been
        // constructed at the coordinate (0,0,0), it will be translated
        // to the offset coordinates supplied by this function.
        void setOffset (double x, double y, double z);
        // Sets rotation for the object.
        void setRotation (double rotX, double rotY, double rotZ);
        // Sets scale factor for the object.
        void setScale (double scaleX, double scaleY, double scaleZ);
        // Gets the offset for the object.
        void getOffset (double& x, double& y, double& z) const;

    protected:
        // Utility function to perform transformations on object.
        // The object is first scaled, then rotated and finally translated 
        // according to the corresponding attributes on the object.
        void transform ();

        // Draws a three dimensional rectangular prism.  The top of the 
        // rectangular is drawn in the x-y plane, and then sides are drawn with
        // the given thickness in the negative-z direction.  The bottom is also
        // drawn in the x-y plane with a z-offset of -thickness.
        static void draw3DRectangle (double x1, double y1, 
                                     double x2, double y2, double thickness);

        // Draws a three dimensional cylinder.  The top of the cylinder is
        // drawn in the x-y plane with radius r and z-offset of zero.  The
        // sides are drawn with the given thickness in the negative-z direction.
        // The bottom is also drawn in the x-y plane with a z-offset of 
        // -thickness.
        static void drawCylinder (double x1, double y1, double radius, 
                                  double zOffset, double thickness, 
                                  int segments);

    // Member variables
    protected:
        double _offsetX, _offsetY, _offsetZ;
        double _scaleX, _scaleY, _scaleZ;
        double _rotX, _rotY, _rotZ;
};

__END_NAMESPACE_DECL_

#endif

